<template>
	<view class="container">
		<!-- <view class="productBox" v-if="!isServer" v-for="(item, index) in goodsList" :key="item.orderInfo.id">
					
						<u-image :lazy-load="true" :src="$u.file.getMedieUrl(item.orderSkus[0].image)" 
					 style="height: 160rpx; width: 160rpx"></u-image>
						<view class="middle-box" @click="handleCompleted(item)">
							
								<view class="tittle-box">
									<view class="productBox-tittle">
										Order:{{ item.orderInfo.id }}
									</view>
									<view class="status" v-if="isStatus">
										{{item.orderInfo.goodStatus }}
									</view>
									<view class="status" v-else-if="isComment">
										{{item.orderInfo.commentStatus }}
									</view>
									
								</view>
								
							
							
								<view class="productBox-intro" >
									<view class="intro-box" v-for="sku in item.orderSkus" :key="sku.id">
										{{ sku.name }}
									</view>
									
								</view>
							
							<view class="productBox-price">${{ item.orderInfo.moneys.toFixed(2) }}</view>
							
							<view class="handle-button" v-if="btnText">
								<u-dropdown
								 ref="uDropdown" 
								 height="40rpx" 
								 active-color="#A8A8A8"
								 >
								 <u-dropdown-item 
								 class="cancel-btn"
								  duration="0"  
								  border-radius="50rpx" 
									v-model="value"
									  v-if="cancelType===0"
									   :options="options1"
										@change="change(item)"
									></u-dropdown-item>
									<u-dropdown-item 
									class="cancel-btn" 
									duration="0"
									  border-radius="50rpx"  
									v-model="value" 
									 v-if="cancelType===1" 
									 :options="options2"
									  @change="change(item)"
									></u-dropdown-item>
									<u-dropdown-item
									class="cancel-btn" 
									duration="0"
									  border-radius="50rpx"  
									v-model="value" 
									 v-if="cancelType===2" 
									 :options="options3"
									  @change="change(item)"
									></u-dropdown-item>
								</u-dropdown>
								<u-button type="default" v-if="cancelType!==2" @click="pay(item)">{{btnText}}</u-button>
							</view>
							<view class="order-finished-time" v-else="item.orderInfo.createTime">
								
								<view class=""  >
									
									<uni-dateformat :date="Number(item.orderInfo.createTime)"></uni-dateformat>
								</view>
								
							</view>
							
						</view>
			</view> -->

		<view class="goods-card" v-if="!isServer" v-for="(item, index) in goodsList" :key="item.orderInfo.id">
			<!-- <view class="productBox"  style="flex-direction: column;">				
				<view class="middle-box" style="display: flex;">
					<u-image :lazy-load="true" :src="$u.file.getMedieUrl(item.orderSkus[0].image)"
					style="height: 160rpx; width: 160rpx">
					</u-image>
					<view class="middle-box" style="width: 70%;padding-left: 20rpx;">	
							<view class="status" v-if="isStatus" :class="item.orderInfo.payStatus == 0 && item.orderInfo.orderStatus != -1 ? 'noPay' : ''">
								{{ item.orderInfo.goodStatus }}
							</view>
							<view class="status" v-else-if="isComment">
								{{ item.orderInfo.commentStatus }}
							</view>
						<view class="tittle-box" style="width: 160%;">
							<view class="order-time" >
								<view class="">{{ $t('order.orderTime') }}:</view>
								<uni-dateformat format="yyyy-MM-dd hh:mm" :date="Number(item.orderInfo.createTime)"></uni-dateformat>
							</view>
							
						</view>
						
						<view class="productBox-intro">
							<view class="" style="width: 38%; color: #91909a">{{ $t('order.importContent') }}:</view>
							<view class="" style="width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: break-all">
								<text style="width: 50%" class="intro-box" v-for="sku in item.orderSkus" :key="sku.id">
									{{ sku.name }}
								</text>
							</view>
						</view>
						
						<view class="productBox-intro">
							<view class="" style="width: 28%; color: #91909a">{{ $t('order.orderNumber') }}:</view>
							<view class="intro-box">
								{{ item.orderInfo.id }}
							</view>
						</view> 
						
					</view>-->

			<!-- <view class="handle-button" v-if="btnText">
						<u-dropdown ref="uDropdown" height="40rpx" active-color="#A8A8A8">
							<u-dropdown-item
								class="cancel-btn"
								duration="0"
								border-radius="50rpx"
								v-model="value"
								v-if="cancelType === 0"
								:options="options1"
								@change="change(item)"
							></u-dropdown-item>
							<u-dropdown-item
								class="cancel-btn"
								duration="0"
								border-radius="50rpx"
								v-model="value"
								v-if="cancelType === 1"
								:options="options2"
								@change="change(item)"
							></u-dropdown-item>
							<u-dropdown-item
								class="cancel-btn"
								duration="0"
								border-radius="50rpx"
								v-model="value"
								v-if="cancelType === 2"
								:options="options3"
								@change="change(item)"
							></u-dropdown-item>
						</u-dropdown>
					</view> -->
			<!-- 			</view>
				<view class="middle-box" style="width: 100%;">
					
				<view class="productBox-intro" style="justify-content: space-between;align-items: center;">
					<view class="">
						共{{item.orderInfo.totalNum}}件
					</view>
					<view class="" style="display: flex;align-items: center;">
						<view class="">{{ $t('order.payment') }}</view>
						<view class="intro-box" style="font-size: 32rpx">
							{{ item.orderInfo.moneys.toFixed(2) }}
						</view>
					</view>
				</view>
				</view>
			</view>
			 -->

			<view class="productBox" style="flex-direction: column">
				<!-- 订单号 -->
				<view class="middle-box" style="justify-content: space-between; align-items: center">
					<view class="productBox-intro">
						<view class="" style="width: 60%; color: #91909a; font-size: 26rpx">{{ $t('order.orderNumber') }}:</view>
						<view class="tittle-box">
							{{ item.orderInfo.orderNo }}
						</view>
					</view>
					<!-- 待支付状态颜色不一样 -->
					<view class="status" v-if="isStatus" :class="item.orderInfo.orderStatus == 0 ? 'noPay' : ''">
						{{ item.orderInfo.goodStatus }}
					</view>
					<!-- 	<view class="status" v-else-if="isComment">
						{{ item.orderInfo.commentStatus }}
					</view> -->
				</view>
				<!-- 数量 -->
				<view class="middle-box" style="display: flex; position: relative" @click="handleCompleted(item)">
					<scroll-view :scroll-x="true" style="white-space: nowrap; height: 144rpx">
						<view class="">
							<view class="image-box">
								<view class="image-item" v-for="img in item.orderSkus" :key="img.id">
									<u-image :border-radius="18" :lazy-load="true" :src="$u.file.getMedieUrl(img.image)" width="144rpx" height="144rpx" mode="aspectFill"></u-image>
								</view>
								<view class="goods-name" v-if="item.orderSkus.length == 1" style="display: inline-block">
									{{ item.orderSkus[0].goodsDesc }}
								</view>
								<view class="image-item" style="width: 144rpx; height: 144rpx; display: inline-block"></view>
							</view>
						</view>
					</scroll-view>
					<view class="intro-box">
						<view class="price-box">${{ item.orderInfo.moneys.toFixed(2) }}</view>
						<view class="totalNum-box">{{ $t('home.total') }} {{ item.orderInfo.totalNum }}{{ $t('home.item') }}</view>
					</view>
				</view>
			</view>

			<view class="bottom-box">
				<!-- 未付款 -->
				<view class="" style="display: flex; justify-content: end; width: 100%" v-if="item.orderInfo.orderStatus == 0">
					<!-- 取消订单 -->
					<view class="bottom-btn" style="display: flex; border: 1px solid #b6b6b6" @click="change(item)">
						<view class="bottom-text" style="color: #91909a; ">{{ $t('order.cancelOrder') }}</view>
					</view>
					<!-- 修改地址 -->
					<view class="bottom-btn" style="display: flex; border: 1px solid #b6b6b6" @click="changeShow(item)">
						<view class="bottom-text" style="color: #91909a; ">{{ $t('order.changeAddress') }}</view>
					</view>
					<!-- 立即付款 -->
					<view class="bottom-btn" style="display: flex; justify-content: center; align-items: center; background: #2934d0; width: 226rpx" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #fff; ">{{ $t('order.immediatePayment') }}</view>
						<view class="bottom-text" style="color: #fff; margin-left: 10rpx">
							<u-count-down
								bg-color="rgba(255,255,255,0)"
								separator-color="#FFFFFF"
								font-size="16"
								color="#FFFFFF"
								:timestamp="item.orderInfo.countTime"
								:show-days="false"
								:show-hours="false"
							></u-count-down>
						</view>
					</view>
				</view>
				<!-- 其他状态 -->
				<view class="" style="display: flex; justify-content: end; width: 100%" v-else>
					<!-- 查看详情 -->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus != -1 "  style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{  $t('order.viewDetails') }}
						</view>
					</view>
					<!-- 前往评价 -->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == 3" style="border: 1px solid #b6b6b6" @click="goEvaluate(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ item.comment ? $t('orderDetails.evaluationed') : $t('orderDetails.evaluation') }}
						</view>
					</view>

					<!-- 申请退款  未发货-->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == 1" style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('order.drawback') }}
						</view>
					</view>
					<!-- 查看物流 已发货-->
					<view class="bottom-btn" v-else-if="item.orderInfo.orderStatus == 2" style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('orderDetails.logistics') }}
						</view>
					</view>
					<!--申请售后  已收货 -->
					<view class="bottom-btn" v-else-if="item.orderInfo.orderStatus == 3" style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('order.service') }}
						</view>
					</view>

					<!-- 删除订单 已取消-->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == -1" style="border: 1px solid #b6b6b6" @click="deleteOrder(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('order.deleteOrder') }}
						</view>
					</view>
					<!-- 加入购物车 -->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == -1" style="border: 1px solid #2934d0; background-color: #2934d0" @click="addCar(item)">
						<view class="bottom-text" style="color: #dedede">
							{{ $t('order.joinCart') }}
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 售后 -->
		<view class="goods-card" v-if="isServer" v-for="(item, index) in goodsList" :key="item.orderInfo.id">		
			<view class="productBox" style="flex-direction: column">
				<!-- 订单号 -->
				<view class="middle-box" style="justify-content: space-between; align-items: center">
					<view class="productBox-intro">
						<view class="" style="width: 60%; color: #91909a; font-size: 26rpx">{{ $t('order.orderNumber') }}:</view>
						<view class="tittle-box">
							{{ item.orderInfo.orderNo }}
						</view>
					</view>
					<!-- 待支付状态颜色不一样 -->
					<view class="status" v-if="isStatus" :class="item.orderInfo.orderStatus == 0 ? 'noPay' : ''">
						{{ item.orderInfo.goodStatus }}
					</view>
					<!-- 	<view class="status" v-else-if="isComment">
						{{ item.orderInfo.commentStatus }}
					</view> -->
				</view>
				<!-- 数量 -->
				<view class="middle-box" style="display: flex; position: relative" @click="handleCompleted(item)">
					<scroll-view :scroll-x="true" style="white-space: nowrap; height: 144rpx">
						<view class="">
							<view class="image-box">
								<view class="image-item" v-for="img in item.orderSkus" :key="img.id">
									<u-image :border-radius="18" :lazy-load="true" :src="$u.file.getMedieUrl(img.image)" width="144rpx" height="144rpx" mode="aspectFill"></u-image>
								</view>
								<view class="goods-name" v-if="item.orderSkus.length == 1" style="display: inline-block">
									{{ item.orderSkus[0].name }}
								</view>
								<view class="image-item" style="width: 144rpx; height: 144rpx; display: inline-block"></view>
							</view>
						</view>
					</scroll-view>
					<view class="intro-box">
						<view class="price-box">${{ item.orderInfo.moneys.toFixed(2) }}</view>
						<view class="totalNum-box">{{ $t('home.total') }} {{ item.orderInfo.totalNum }}{{ $t('home.item') }}</view>
					</view>
				</view>
			</view>
		
			<view class="bottom-box">
				<!-- 未付款 -->
				<view class="" style="display: flex; justify-content: end; width: 100%" v-if="item.orderInfo.orderStatus == 0">
					<!-- 取消订单 -->
					<view class="bottom-btn" style="display: flex; border: 1px solid #b6b6b6" @click="change(item)">
						<view class="bottom-text" style="color: #91909a; font-size: 20rpx">{{ $t('order.cancelOrder') }}</view>
					</view>
					<!-- 修改地址 -->
					<view class="bottom-btn" style="display: flex; border: 1px solid #b6b6b6" @click="changeShow(item)">
						<view class="bottom-text" style="color: #91909a; font-size: 20rpx">{{ $t('order.changeAddress') }}</view>
					</view>
					<!-- 立即付款 -->
					<view class="bottom-btn" style="display: flex; justify-content: center; align-items: center; background: #2934d0; width: 226rpx" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #fff; font-size: 20rpx">{{ $t('order.immediatePayment') }}</view>
						<view class="bottom-text" style="color: #fff; margin-left: 10rpx">
							<u-count-down
								bg-color="rgba(255,255,255,0)"
								separator-color="#FFFFFF"
								font-size="22"
								color="#FFFFFF"
								:timestamp="item.orderInfo.countTime"
								:show-days="false"
								:show-hours="false"
							></u-count-down>
						</view>
					</view>
				</view>
				<!-- 其他状态 -->
				<view class="" style="display: flex; justify-content: end; width: 100%" v-else>
					<!-- 查看详情 -->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus != -1 "  style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{  $t('order.viewDetails') }}
						</view>
					</view>
					<!-- 取消申请 -->
					<view class="bottom-btn" v-if="handleCancle(item)"  style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{$t('system.cancelApplication')}}
						</view>
					</view>
					<!-- 填写单号 -->
					<view class="bottom-btn" v-if="handleFill(item)"  style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{$t('system.fillNumber')}}
						</view>
					</view>
					<!-- 前往评价 -->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == 3" style="border: 1px solid #b6b6b6" @click="goEvaluate(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ item.comment ? $t('orderDetails.evaluationed') : $t('orderDetails.evaluation') }}
						</view>
					</view>
		
					<!-- 申请退款  未发货-->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == 1" style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('order.drawback') }}
						</view>
					</view>
					<!-- 查看物流 已发货-->
					<view class="bottom-btn" v-else-if="item.orderInfo.orderStatus == 2" style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('orderDetails.logistics') }}
						</view>
					</view>
					<!--申请售后  已收货 -->
					<view class="bottom-btn" v-else-if="item.orderInfo.orderStatus == 3" style="border: 1px solid #b6b6b6" @click="handleCompleted(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('order.service') }}
						</view>
					</view>
		
					<!-- 删除订单 已取消-->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == -1" style="border: 1px solid #b6b6b6" @click="deleteOrder(item)">
						<view class="bottom-text" style="color: #91909a">
							{{ $t('order.deleteOrder') }}
						</view>
					</view>
					<!-- 加入购物车 -->
					<view class="bottom-btn" v-if="item.orderInfo.orderStatus == -1" style="border: 1px solid #2934d0; background-color: #2934d0" @click="addCar(item)">
						<view class="bottom-text" style="color: #dedede">
							{{ $t('order.joinCart') }}
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 售后 -->
		<!-- 	<view class="productBox" v-if="isServer" v-for="(item, index) in goodsList" :key="item.id">
					
						<u-image :lazy-load="true" :src="$u.file.getMedieUrl(item.orderSkuDto.image)" 
						@click="confirm(item)" style="height: 160rpx; width: 160rpx"></u-image>
						<view class="middle-box" @click="handleCompleted(item)">
							
								<view class="tittle-box">
									<view class="productBox-tittle">
										{{ item.orderSkuDto.name }}
									</view>
									<view class="status" v-if="isStatus">
										<view class="">
											{{item.goodStatus}}
										</view>
										
									</view>
								</view>

								<view class="productBox-intro" >
									<view class="intro-box">
										{{ item.orderSkuDto.goodsDesc }}
									</view>
										
									
								</view>
							
							<view class="productBox-price">${{ item.orderSkuDto.money }}</view>
							
							
							<view class="order-finished-time">
								
								<view class=""  >
									{{item.createTime}}
								</view>
								
							</view>
							
						</view>
			</view> -->

		<!-- 		<view class="goods-card" v-if="isServer" v-for="(item, index) in goodsList" :key="item.id">
			<view class="productBox" style="flex-direction: column">
				<view class="middle-box" style="width: 100%;justify-content: space-between;">
					<view class="productBox-intro">
						<view class="" style="width: 60%; color: #91909a; font-size: 26rpx">{{ $t('order.orderNumber') }}:</view>
						<view class="tittle-box">
							{{ item.orderInfo.orderNo }}
						</view>
					</view>
					<view class="status" v-if="isStatus" >
						{{item.orderInfo.goodStatus }}
					</view>
				</view>
				
				<view class="middle-box" style="align-items: center;">
					<u-image :border-radius="18" :lazy-load="true" :src="$u.file.getMedieUrl(item.orderSkuDto.image)" @click="confirm(item)" style="height: 144rpx; width: 144rpx"></u-image>
					<view class="detail-box" >
						
						<view class="tittle-box" style="width: 170%; font-size: 28rpx">
							<view class="order-time" style="width: 90%">
								<view class="" style="color: #91909a;min-width: 140rpx;">{{ $t('order.orderTime1') }}:</view>
								<view class="" style="font-size: 26rpx; ">
									  {{ item.createTime }}
								</view>
							</view>
						</view>
						<view class="productBox-intro">
							<view class="" style="color: #91909a;min-width: 140rpx;">{{ $t('order.importContent') }}:</view>
							<view class="info-des" >
								  {{ item.orderSkuDto.name }}
							</view>
						</view>

					</view>
				</view>
				<view class="middle-box" style="width: 100%;justify-content: space-between; align-items: center">
					
						<view class="">{{$t('home.total')}} {{ item.orderSkuDto.num }}{{$t('home.item')}}</view>
						<view class="" style="display: flex; align-items: center">
							<view class="">{{ $t('order.payment') }}</view>
							<view class="" style="font-size: 32rpx">
								{{ item.orderSkuDto.money.toFixed(2) }}
							</view>
						</view>
					
				</view>
			</view>

			<view class="bottom-box" @click="handleCompleted(item)" v-if="item.type!=3">
				<view class="bottom-btn" style="border: 1px solid #b6b6b6">
					<view class="bottom-text" style="color: #91909a">{{ $t('order.viewDetails') }}</view>
				</view>
			</view>
			<view class="bottom-box"  v-else @click="handleRefound(item)">
				<view class="bottom-btn" style="border: 1px solid #b6b6b6">
					<view class="bottom-text" style="color: #91909a">{{ $t('order.viewDetails') }}</view>
				</view>
			</view>

			<view class="list-none" v-if="!goodsList.length">
				<imageForSize w="264rpx" h="230rpx" :src="require('@/static/images/no-data.png')"></imageForSize>
			</view>
		</view> -->

		<!-- 修改地址信息弹窗 -->
		<u-popup safe-area-inset-bottom border-radius="60" class="change-order-address" v-model="changeOrderAddressPopShow" mode="bottom">
			<view class="popup-main">
				<view class="header">
					<text>{{ $t('orderDetails.changeAddress') }}</text>
					<u-icon @click="changeOrderAddressPopShow = false" name="close"></u-icon>
				</view>
				<!-- <view class="" style="width: 100%; display: flex; justify-content: end; align-items: center; margin-top: 20rpx">
					<view class="addAddress" style="display: flex; justify-content: end; align-items: center" @click="$u.route('/pages/addAddress/addAddress')">
						<u-icon size="20" name="plus" color="#FC3D5C"></u-icon>
						<view class="" style="color: #fc3d5c; font-size: 30rpx">
							{{ $t('orderDetails.addNew') }}
						</view>
					</view>
				</view> -->
				<!-- 选择地址 -->
				<view class="check-address">
					<view class="address-item" v-for="item in addressList" :key="item.id">
						<view @click="currentCheckChange(item)" :class="`check-icon ${currentAddress.id === item.id ? 'is-checked' : ''}`"></view>
						<view class="check-text" @click="currentCheckChange(item)">
							<view class="user-name">
								{{ item.userName }}
							</view>
							<view class="address">
								{{ item.address }}
							</view>
						</view>
					</view>
				</view>
				<view class="" style="display: flex; justify-content: space-around">
					<button
						style="color: #ffffff; backgroundcolor: #fc3d5c; bordercolor: #fc3d5c; width: 40%; height: 100rpx"
						type="default"
						@click="$u.route('/pages/addAddress/addAddress')"
					>
						{{ $t('orderDetails.addNew') }}
					</button>
					<button style="width: 40%; height: 100rpx" type="default" @click="changeAddress">{{ $t('orderDetails.confirm') }}</button>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
export default {
	name: 'goodsCard',
	data() {
		return {
			addressList: [],
			currentAddress: {},
			changeOrderAddressPopShow: false,
			value: null,
			options1: [
				{
					label: this.$t('orderDetails.cancellation'),
					value: 1
				}
			],
			options2: [
				{
					label: this.$t('orderDetails.reimburse'),
					value: 2
				}
			],
			options3: [
				{
					label: this.$t('orderDetails.apply'),
					value: 3
				}
			],
			options4: [
				{
					label: this.$t('orderDetails.CancelApplication'),
					value: 4
				}
			]
		};
	},
	props: {
		//数据
		goodsList: {
			type: Array,
			default: () => []
		},
		// 按钮文字
		btnText: {
			default: '',
			type: String
		},
		// 是否显示状态
		isStatus: {
			default: false,
			type: Boolean
		},
		// 取消操作
		cancelType: {
			default: null,
			type: Number
		},
		//未发货页面
		unShipped: {
			default: false,
			type: Boolean
		},
		//完成界面
		completed: {
			default: false,
			type: Boolean
		},
		//售后界面
		isServer: {
			default: false,
			type: Boolean
		},
		//评价
		isComment: {
			default: false,
			type: Boolean
		}
	},
	beforeUpdate() {
		this.handleCommentList();
		// console.log(this.cancelType);
		this.handleGoodStatus();
	},

	created() {
		this.handleCommentList();
		// console.log(666, this.goodsList);
		this.handleGoodStatus();
		this.getAddressList();
	},
	methods: {
		handleFill(item){
			let status=item.orderSkus.some(it=>{
				return it.returnInfo && it.returnInfo.status == 1 && it.returnInfo.type != 3
			})
			return status
		},
		handleCancle(item){
			let status=item.orderSkus.some(it=>{
				return it.returnInfo && it.returnInfo.status == 0
			})
			return status
		},
		handleRefound(item) {
			console.log('-------', item);
			this.$u.vuex('vuex_shoping_cartList', item);
			uni.navigateTo({
				url: '/pages/order/refundProgress',
				animationType: 'slide-in-right',
				animationDuration: 300
			});
		},
		//前往评价
		goEvaluate(item) {
			this.$u.vuex('vuex_shoping_cartList', item);
			if (!item.comment) {
				//评价
				uni.navigateTo({
					url: '/pages/order/evaluateDetail',
					animationType: 'slide-in-right',
					animationDuration: 300
				});
			}
		},
		//申请退款
		drawback(item) {
			this.$emit('drawback', item);
		},
		// 删除订单
		deleteOrder(item) {
			this.$emit('deleteOrder', item);
		},
		//添加至购物车
		addCar(item) {
			item.orderSkus.forEach((item) => {
				let obj = {
					skuId: item.skuId,
					num: item.num,
					taskId: item.taskId
				};

				this.$u.post('/app/cart/add', obj).then((res) => {
					this.$u.toast(this.$t('product.AddedToCart'));
				});
			});
		},
		//获取地址列表
		getAddressList() {
			this.$u
				.post('/app/user/address/page', {
					pageSize: 10000,
					pageNum: 1
				})
				.then((res) => {
					this.addressList = res.data.records;
				});
		},
		//修改订单地址
		alertAddress() {
			this.$u
				.post('/app/shopOrderInfo/modifyAddress', {
					orderId: this.orderDetailsId,
					addressId: this.currentAddress.id
				})
				.then((res) => {});
		},
		// 确定地址
		changeAddress() {
			this.changeOrderAddressPopShow = false;
			if (this.currentAddress.id) {
				this.alertAddress();
			}
		},
		// 地址修改选中
		currentCheckChange(item) {
			if (this.currentAddress.id !== item.id) {
				this.currentAddress = item;
				console.log(888, this.currentAddress);
			} else {
				return;
			}
		},
		changeShow(item) {
			this.changeOrderAddressPopShow = true;
			this.orderDetailsId = item.orderInfo.id;
		},

		handleCommentList() {
			this.goodsList.forEach((item) => {
				if ('comment' in item) {
					if (item.comment == true) {
						this.$set(item.orderInfo, 'commentStatus', this.$t('orderDetails.evaluated'));
					} else {
						this.$set(item.orderInfo, 'commentStatus', this.$t('orderDetails.Unevaluated'));
					}
				}
			});
		},

		//支付状态,0:未支付，1：已支付，2：支付失败
		handleGoodStatus() {
			console.log(111, this.goodsList);
			if (this.goodsList) {
				this.goodsList.forEach((item) => {
					if (!this.isServer) {
						//完成状态
						let d = Number(item.orderInfo.payStatus);
						// console.log('payStatus',d);
						switch (d) {
							case 0:
								// 已取消
								if (item.orderInfo.orderStatus == -1) {
									this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.canceled'));
								} else if (item.orderInfo.orderStatus == 0) {
									//待付款
									this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.Unpaid'));
									//处理倒计时间
									let time = new Date().getTime() - item.orderInfo.createTime;
									if (time < 1800000) {
										let count = 1800 - time / 1000;
										this.$set(item.orderInfo, 'countTime', count);
									}
								}
								break;
							case 1:
								let r = Number(item.orderInfo.orderStatus);
								// console.log('orderStatus',r);
								//订单状态,-1已取消，0待支付，1未发货,2已发货，3已收货，4已申请售后，5审核通过，6售后完成
								switch (r) {
									case 1:
										this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.UnShipped'));
										break;
									case 2:
										this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.Shipped'));
										break;
									case 3:
										this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.received')); //
										break;
									case 4:
										this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.refunding'));

										break;
									case 5:
										this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.refunding'));

										break;
									case 6:
										this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.afterSaleCompletion'));

										break;

									default:
										break;
								}
								break;
							case 2:
								// this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.paymentFailure'));
								break;

							default:
								// let s = item.orderStatus;
								//订单状态,0:未发货,1:已发货，2：确认收货，3：退货中，4：退货完成
								// switch (s) {
								// 	case 0:
								// 		this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.UnShipped'));
								// 		break;
								// 	case 1:
								// 		this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.Shipped'));
								// 		break;
								// 	case 2:
								// 		this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.confirmReceipt'));
								// 		break;
								// 	case 3:
								// 		this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.ReturningGoods'));
								// 		break;
								// 	default:
								// 		this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.ReturnCompleted'));
								// 		break;
								// }
								break;
						}
						// console.log(2222,this.goodsList);
					} else {
						
						if(item.orderInfo.showStatus==6){
							this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.afterSaleCompletion'));
							
						}else{
							this.$set(item.orderInfo, 'goodStatus', this.$t('orderDetails.refunding'));
						}
						
						
						
						// isDelete  0未取消1已取消
						// status	0未处理1不同意2同意
						// let p = Number(item.isDelete);
						//售后参数
						// switch (p) {
						// 	case 0:
						// 		let s = Number(item.status);
						// 		switch (s) {
						// 			case 0:
						// 				if (item.processUser == 1 && item.sign == 1) {
						// 					this.$set(item, 'goodStatus', this.$t('orderDetails.UnderReview')); //可取消申请
						// 				} else if (item.processUser == 1 && item.sign == 0) {
						// 					this.$set(item, 'goodStatus', this.$t('orderDetails.undisposed')); //可取消申请
						// 				} else if (item.processUser == 2) {
						// 					if (item.type == 1) {
						// 						this.$set(item, 'goodStatus', this.$t('orderDetails.ReturningGoods')); //退货中
						// 					} else if (item.type == 2) {
						// 						this.$set(item, 'goodStatus', this.$t('orderDetails.ExchangingGoods')); //换货中
						// 					} else {
						// 						this.$set(item, 'goodStatus', this.$t('orderDetails.refunded')); //退款中
						// 					}
						// 				}

						// 				break;
						// 			case 1:
						// 				if (item.processUser == 2) {
						// 					if (item.type == 1) {
						// 						this.$set(item, 'goodStatus', this.$t('orderDetails.UnsuccessfulReturn')); //退货不成功
						// 					} else if (item.type == 2) {
						// 						this.$set(item, 'goodStatus', this.$t('orderDetails.UnsuccessfulExchange')); //换货不成功
						// 					} else {
						// 						this.$set(item, 'goodStatus', this.$t('orderDetails.UnsuccessfulRefunded')); //退款不成功
						// 					} //
						// 				} else {
						// 					this.$set(item, 'goodStatus', this.$t('orderDetails.UnsuccessfulExchange')); //换货不成功
						// 				}

						// 				break;
						// 			case 2:
						// 				// if (item.processUser == 2) {
						// 				// 	if (item.type == 1) {

						// 				// 		this.$set(item, 'goodStatus', this.$t('orderDetails.Approved'));//审核未通过
						// 				// 	} else {
						// 				// 		this.$set(item, 'goodStatus', this.$t('orderDetails.ReplacementCompleted'));//换货完成
						// 				// 	} //
						// 				// } else {
						// 				// 	this.$set(item, 'goodStatus', this.$t('orderDetails.Approved')); //输入运单号 审核通过
						// 				// }
						// 				this.$set(item, 'goodStatus', this.$t('orderDetails.Approved')); //输入运单号 审核通过

						// 				break;
						// 			default:
						// 				break;
						// 		}
						// 		break;
						// 	case 1:
						// 		this.$set(item, 'goodStatus', this.$t('orderDetails.canceled')); //无操作 已取消
						// 		break;
						// 	default:
						// 		break;
						// }
					}
				});
			}
		},

		confirm(item) {
			this.$emit('getGoodsInfo', item);
		},
		handleCompleted(item) {
			// console.log(888999, item);
			if (this.completed || this.unShipped || this.cancelType !== 2) {
				this.$emit('pay', item);
			}
		},
		pay(item) {
			this.$emit('pay', item);
		},
		change(item) {
			this.$emit('change', item); //value=1:取消订单  value=2申请退款
		}
	}
};
</script>

<style lang="scss" scoped>
/deep/ .u-dropdown__content {
	height: 50rpx !important;
	width: 40%;
	left: -21px;
}
/deep/.u-dropdown__menu__item {
	justify-content: start;
}
/deep/.u-cell {
	padding: 0;
}
/deep/.u-cell__value {
	display: none;
}
.container {
	// overflow: auto;
	// height: 100%;
	// 'background: #ffffff;'
	// position: absolute;
	// top: 110rpx;
	// right: 0;
	// left: 0;
	// bottom: 0;
	.goods-card {
		margin: 30rpx;
		border-radius: 16rpx;
		border: 1px solid #e1e8e8;
	}
	.productBox {
		background: #ffffff;

		opacity: 1;
		// border-bottom: 1px solid #e1e8e8;

		margin: 20rpx 20rpx 10rpx 20rpx;
		display: flex;
		// padding-bottom: 10px;
		// justify-content: space-between;

		.middle-box {
			width: 100%;
			display: flex;
			// align-items: center;
			.image-box {
				// position: relative;
				// display: flex;
				// flex-wrap: nowrap;
				// overflow: hidden;
				// width: 700rpx;
				margin-right: 154rpx;
				.image-item {
					display: inline-block;
					height: 144rpx;
					width: 144rpx;
					margin-right: 10rpx;
					border-radius: 26rpx;
					overflow: hidden;
				}
			}
			.tittle-box {
				display: flex;
				justify-content: space-between;
				width: 100%;
				margin: 0;
				font-size: 26rpx;
			}
			.productBox-tittle {
				font-size: 30rpx;
				color: #000000;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				width: 90%;
			}
			.status {
				color: #2934d0;
				// width: 100%;
				text-align: end;
				margin: 0;
				margin-right: 10rpx;
			}
			.productBox-intro {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 24rpx;
				margin: 20rpx 0;
				align-items: center;
				display: flex;
				min-width: 300rpx;
				.intro-box {
					width: 170%;
					color: #1b1d29;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					word-break: break-all;
				}
				view {
					matgin-left: 10rpx;
				}
			}
			.productBox-price {
				font-size: 30rpx;
				color: #000000;
				font-weight: 500;
			}
			.time-box {
				font-weight: 400;
				color: #a8a8a8;
				font-size: 24rpx;
				text-align: end;
			}
			.order-finished-time {
				display: flex;
				justify-content: end;

				&.order-finished-time {
					font-size: 24rpx;
					color: #a8a8a8;
				}
			}

			.handle-button {
				display: flex;
				justify-content: space-between;
			}
			uni-button {
				padding: 0 20rpx;
				height: 48rpx;
				border-radius: 12rpx;
				margin: 0;
				color: #2934d0;
				font-size: 28rpx;
				border: 1px solid #2934d0;

				&::after {
					border: 2rpx solid #2934d0;
				}
			}
		}
	}
}
.list-none {
	display: flex;
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}
.order-time {
	display: flex;
	width: 150%;
	color: #1b1d29;
	font-family: PingFang SC;
	font-weight: bold;
	font-size: 24rpx;
}
.noPay {
	color: #fc3d5c !important;
}
.bottom-box {
	padding: 30rpx;
	display: flex;
	justify-content: end;
	align-items: center;
	.bottom-btn {
		padding: 10rpx 20rpx;
		border-radius: 40rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 18rpx;
		.bottom-text {
			font-size: 16rpx;
		}
	}
}
.change-order-address {
	.popup-main {
		padding: 56rpx 40rpx;
		max-height: 1080rpx;
		.header {
			padding: 0 10rpx;
			display: flex;
			justify-content: space-between;
			font-size: 30rpx;

			> text {
				color: #212121;
				font-weight: 500;
			}
		}

		.check-address {
			margin-top: 50rpx;
			height: 400px;
			overflow: auto;
			.address-item {
				display: flex;
				margin-bottom: 68rpx;

				.check-text {
					width: 0;
					flex: auto;
					color: #1e2432;

					.user-name {
						font-size: 30rpx;
						line-height: 36rpx;
						font-weight: 500;
					}

					.address {
						margin-top: 6rpx;
						font-size: 26rpx;
						line-height: 40rpx;
					}
				}

				.check-icon {
					width: 32rpx;
					height: 32rpx;
					border-radius: 50%;
					border: 4rpx solid #212121;
					margin-right: 28rpx;
					margin-top: 8rpx;
					position: relative;

					&.is-checked::after {
						content: '';
						position: absolute;
						left: 50%;
						top: 50%;
						transform: translate(-50%, -50%);
						width: 70%;
						height: 70%;
						border-radius: 50%;
						background-color: #212121;
					}
				}
			}
		}
	}
}
.price-box {
	color: #02010e;
	font-family: PingFang SC;
	font-weight: 500;
	font-size: 28rpx;
}
.totalNum-box {
	color: #686872;
	font-family: PingFang SC;
	font-size: 24rpx;
}
.intro-box {
	display: flex;
	justify-content: center;
	flex-direction: column;
	align-items: center;
	width: 144rpx;
	height: 144rpx;
	background-color: rgba(255, 255, 255, 0.2);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(5px);
	border-radius: 5px;
	position: absolute;
	right: 0;
	bottom: 0;
}
.goods-name {
	width: 302rpx;
	height: 144rpx;
	line-height: 144rpx;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.detail-box {
	margin-left: 20rpx;
	display: flex;
	flex-direction: column;
}
.info-des {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	width: 260rpx;
}
</style>
